package com.mainboot.example.kafka.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import com.mainboot.example.kafka.util.DateUtils;
/**
 * 
 * @author 闽南码农
 *  
 */
@Component
public class KafkaSender {
    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    /**
     	* 发送消息到kafka,主题为mainboot
     */
    public void sendTest(){
        kafkaTemplate.send("mainboot","hello,kafka mainboot "  + DateUtils.formatDate(new Date()));
    }
}